import java.util.HashMap;

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
    }

    //最⻓定差⼦序列
    public int longestSubsequence(int[] arr, int difference) {
        HashMap<Integer, Integer> map = new HashMap<>();
        int ret=1;
        for(int a :arr){
            map.put(a, map.getOrDefault(a-difference, 0) + 1);
            ret=Math.max(ret, map.get(a));
        }
        return ret;
    }
}